package com.example.newnoke.view.dialog;

import android.support.v4.app.FragmentManager;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.newnoke.R;

import java.io.File;


/**
 * Created by jiang on 2017/5/10.
 */

public class HDDialgo extends BaseBottomDialog {


    PayCallBack payCallBack;

    private TextView mTitle,mContent,mUnit;
    private ImageView mImageView;


    @Override
    public int getLayoutRes() {
        return R.layout.dialog_hd;
    }

    @Override
    public void onStart() {
        super.onStart();
        setParams( Gravity.CENTER);
    }

    @Override
    public void bindView(View v) {
//        this.getDialog().setCancelable(false);
//        this.getDialog().setCanceledOnTouchOutside(false);
//        this.getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() {
//            @Override
//            public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
//                if (keyCode == KeyEvent.KEYCODE_BACK) {
//                    return true;
//                }
//                return false;
//            }
//        });
        mTitle =  v.findViewById(R.id.tv_title);
        mContent = v.findViewById(R.id.tv_content);
        mUnit = v.findViewById(R.id.tv_unit);
        mImageView = v.findViewById(R.id.img);
        mTitle.setText(getArguments().getString("title"));
        mContent.setText(getArguments().getString("content"));
        mUnit.setText(getArguments().getString("unit"));
        mImageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }

    void toPay() {
        dismiss();
    }

    @Override
    public float getDimAmount() {
        return 0.4f;
    }

    public void show(FragmentManager fragmentManager, PayCallBack payCallBack) {
        show(fragmentManager, getFragmentTag());
        this.payCallBack = payCallBack;
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    public interface PayCallBack {
        void installation(File file);

        void onError(String msg);
    }

}
